package it.unical.canonaco.rende.igpe.game.cbv.logiclayer.engine.component.pawn.stats;


import java.util.LinkedList;

public class Role {

	/**Name of the role/race */
	protected String name;
	
	/**Basis statistics of the role */
	protected Stats characteristics;
	
	/**Abilities statistics of the role. */
	protected LinkedList<AbilityStats> abilities;
	
	/**It's a copy of characteristics, which is used into battles for knowing the maximum values of the statistics. */
	private Stats maxCharacteristics;
	
	/** */
	public Role()
	{
		characteristics = new Stats();
		abilities = new LinkedList<AbilityStats>();
	}
	/**
	 * Deep copy constructor
	 * @param role: the stats role to be copied
	 */
	public Role(Role role)
	{
		
		this.setName(role.getName());
		
		this.characteristics = new Stats(role.characteristics);
		final int numberAbilities = role.abilities.size();
		LinkedList<AbilityStats> abilities = new LinkedList<AbilityStats>();
		for(int index = 0; index < numberAbilities; index++) {
			
			AbilityStats as  = new AbilityStats();
			as.setAbilityValue(role.abilities.get(index).getAbilityValue());
			as.copy(role.abilities.get(index));
			abilities.add(as);
		}
		this.setAbilityStats(abilities);
		
	}
	public String getName()
	{
		return name;
	}
	
	public Stats getCharacteristics()
	{
		return characteristics;
	}
	
	public void setAbilityStats(LinkedList<AbilityStats> abilities)
	{
		this.abilities = abilities;
	}
	
	public LinkedList<AbilityStats> getAbilities()
	{
		return abilities;
	}
	
	public void setName(final String name)
	{
		this.name = name;
	}
	
	public AbilityStats getAbility(final int ability)
	{
		return abilities.get(ability);
	}
	
	public void setCharacteristics(final Stats stats)
	{
		characteristics = stats;
	}
	/**
	 * @return the maxCharacteristics
	 */
	public Stats getMaxCharacteristics() {
		return maxCharacteristics;
	}
	/**
	 * @param maxCharacteristics the maxCharacteristics to set
	 */
	public void setMaxCharacteristics(Stats maxCharacteristics) {
		this.maxCharacteristics = maxCharacteristics;
	}
}
